package com.neusoft.elm.service;

import com.neusoft.elm.dao.UserDao;
import com.neusoft.elm.po.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

@Service
public class UserServiceImpl implements UserService {
    @Autowired
    private UserDao userDao;
    @Transactional(rollbackFor = Exception.class)
    @Override
    public int saveUser(User user) throws Exception {
        int n = userDao.saveUser(user);
        return n;
    }

    @Override
    public User getUserByIdByPass(String userId, String password) throws Exception {

        User user=userDao.getUserByIdByPass(userId,password);
        return user;


    }

    @Override
    public User getUserById(String userId) throws Exception {
        User user=userDao.getUserById(userId);
        return user;
    }
}
